package com.improvedheater;

public class ImprovedTank {

	public static final int OFF=0;
	public static final int LOW=1;
	public static final int HIGH=2;

	private int heaterSetting=OFF;
	private int waterLevel=50;
	private int maximumLevel=100;
	private int waterTemperature=0;
	private int maximumTemperature=98;

	public int getWaterLevel() 
	{
		return waterLevel;
	}

	public int addWater(int amount)
	{
		waterLevel=waterLevel+amount;
		waterTemperature=waterTemperature-amount;
		if (waterTemperature<0) this.waterTemperature=0;
		if (waterLevel>maximumLevel) waterLevel=maximumLevel;
		return waterLevel;
	}

	public int getWater(int amount)
	{
		if (amount>waterLevel) amount=waterLevel;

		waterLevel=waterLevel-amount;
		return amount;
	}

	public void check()
	{
		if (waterLevel>30 &&waterTemperature<maximumTemperature)
		{
			waterTemperature+=heaterSetting;
		}
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	public int getMaximumLevel() {
		return maximumLevel;
	}
	public int getWaterTemperature() {
		return waterTemperature;
	}
	public int getMaximumTemperature() {
		return maximumTemperature;
	}
	public int getHeaterSetting() {
		return heaterSetting;
	}
	public void setHeaterSetting(int heaterSetting) {
		this.heaterSetting = heaterSetting;
	}

}
